class ElderEntity {
  final num? total;
  List<ElderInfo>? rows;

  ElderEntity({this.rows, this.total});

  factory ElderEntity.fromJson(Map<String, dynamic> json) {
    final originList = json['rows'] as List;
    List<ElderInfo> protocolList =
        originList.map((value) => ElderInfo.fromJson(value)).toList();
    return ElderEntity(rows: protocolList, total: json['total']);
  }
}

abstract class IFoodOlder {
  String get selectedOldName;

  num? get selectOldId;
}
class ElderInfo extends IFoodOlder{
  String? nameCn;
  String? name;
  String? elderName;
  num? age;
  num? id;
  num? customerId;
  String? sexName;
  num? sex;
  String? branchName;
  String? buildingNo;
  String? floorNo;
  String? roomNo;
  num? roomId;
  String? statusSecondName;
  String? nurseLevelName;

  String? birthday;
  String? mobile;
  String? healthName;
  String? address;
  String? livingSituationName;
  String? eduDegreeName;
  String? faithName;
  String? economicsName;
  String? retirementPay;
  String? medicalPaymentName;
  String? specialDiseaseRemark;
  String? avoidThing;
  String? preMobile;

  //familyList
  List<ElderFamilyInfo>? familyList;

  num? status;
  String? content;
  String? updatedDate;
  List<ImageInfo>? attachList;

  num? lastId;
  num? nextId;
  num? headimageId;
  num? hospitalizeTimes;
  num? careType;
  String? careTypeName;
  String? tripToolName;
  num? tripTool;
  String? experience;
  String? changeReason;
  String? roomPreference;
  String? checkInPlan;
  String? choosePeopleName;
  num? intentionCityId;
  num? commissionerGroupId;
  num? certificateTypeId;
  String? certificateTypeName;
  num? intentionId;
  num? eduDegreeId;
  num? healthId;
  String? preLiveName;
  num? preLiveId;
  String? cardNo;
  num? faithId;
  num? healthExaminationYearTimes;
  List<ElderTags>? tags;

  ElderInfo({
    this.experience,
    this.tripTool,
    this.tripToolName,
    this.careTypeName,
    this.careType,
    this.hospitalizeTimes,
    this.nameCn,
    this.headimageId,
    this.lastId,
    this.nextId,
    this.content,
    this.updatedDate,
    this.status,
    this.attachList,
    this.name,
    this.elderName,
    this.age,
    this.id,
    this.customerId,
    this.sexName,
    this.branchName,
    this.buildingNo,
    this.floorNo,
    this.roomNo,
    this.statusSecondName,
    this.nurseLevelName,
    this.familyList,
    this.birthday,
    this.mobile,
    this.healthName,
    this.address,
    this.livingSituationName,
    this.eduDegreeName,
    this.faithName,
    this.economicsName,
    this.retirementPay,
    this.medicalPaymentName,
    this.specialDiseaseRemark,
    this.avoidThing,
    this.changeReason,
    this.roomPreference,
    this.checkInPlan,
    this.choosePeopleName,
    this.intentionCityId,
    this.commissionerGroupId,
    this.certificateTypeName,
    this.certificateTypeId,
    this.intentionId,
    this.roomId,
    this.eduDegreeId,
    this.healthId,
    this.preLiveId,
    this.preLiveName,
    this.cardNo,
    this.faithId,
    this.sex,
    this.healthExaminationYearTimes,
    this.tags,
    this.preMobile,
  });

  factory ElderInfo.fromJson(Map<String, dynamic> json) {
    List originList = json['familyList'] as List;
    if (originList == null) originList = [];
    List<ElderFamilyInfo> protocolList =
        originList.map((value) => ElderFamilyInfo.fromJson(value)).toList();

    List originList1 = json['attachList'] as List;
    if (originList1 == null) originList1 = [];
    List<ImageInfo> protocolList1 =
        originList1.map((value) => ImageInfo.fromJson(value)).toList();

    return ElderInfo(
      attachList: protocolList1,
      familyList: protocolList,
      cardNo: json["cardNo"],
      sex: json["sex"],
      healthExaminationYearTimes: json["healthExaminationYearTimes"],
      preLiveName: json["preLiveName"],
      preLiveId: json["preLiveId"],
      healthId: json["healthId"],
      eduDegreeId: json["eduDegreeId"],
      intentionId: json['intentionId'],
      certificateTypeName: json["certificateTypeName"],
      certificateTypeId: json["certificateTypeId"],
      commissionerGroupId: json['commissionerGroupId'],
      intentionCityId: json['intentionCityId'],
      choosePeopleName: json['choosePeopleName'],
      checkInPlan: json["checkInPlan"],
      roomPreference: json["roomPreference"],
      changeReason: json['changeReason'],
      experience: json["experience"],
      tripToolName: json["tripToolName"],
      tripTool: json["tripTool"],
      careType: json["careType"],
      careTypeName: json["careTypeName"],
      hospitalizeTimes: json["hospitalizeTimes"],
      nameCn: json['nameCn'],
      headimageId: json["headimageId"],
      lastId: json["lastId"],
      nextId: json["nextId"],
      name: json['name'],
      elderName: json['elderName'],
      age: json['age'],
      id: json['id'],
      sexName: json['sexName'],
      branchName: json['branchName'],
      buildingNo: json['buildingNo'],
      floorNo: json['floorNo'],
      roomNo: json['roomNo'],
      statusSecondName: json['statusSecondName'],
      nurseLevelName: json['nurseLevelName'],
      birthday: json['birthday'],
      mobile: json['mobile'],
      healthName: json['healthName'],
      address: json['address'],
      livingSituationName: json['livingSituationName'],
      eduDegreeName: json['eduDegreeName'],
      faithName: json['faithName'],
      economicsName: json['economicsName'],
      retirementPay: json['retirementPay'],
      medicalPaymentName: json['medicalPaymentName'],
      specialDiseaseRemark: json['specialDiseaseRemark'],
      avoidThing: json['avoidThing'],
      faithId: json["faithId"],
      roomId: json["roomId"],
        preMobile: json["preMobile"],
      tags: json['tags']==null?[]:(json['tags'] as List).map((e) => ElderTags.fromJson(e)).toList()
    );
  }

  @override
  num? get selectOldId => id;

  @override
  String get selectedOldName => name??"";
}

class ElderFamilyInfo {
  String? name;
  String? relationshipName;
  String? mobile;
  num? sex;

  ElderFamilyInfo({
    this.name,
    this.relationshipName,
    this.mobile,
    this.sex,
  });

  ElderFamilyInfo.fromJson(Map data) {
    name = data['name'];
    relationshipName = data['relationshipName'];
    mobile = data['mobile'];
    sex = data['sex'];
  }
}

class ImageInfo {
  String? path;
  String? fileName;
  String? name;
  num? id;
  num? fileId;

  ImageInfo({
    this.path,
    this.id,
    this.fileName,
    this.fileId,
    this.name,
  });

  ImageInfo.fromJson(Map data) {
    path = data['path'];
    id = data['id'];
    fileName = data['fileName'];
    fileId = data['fileId'];
    name = data['name'];
  }
}


class ElderTags{
  String? tagsName;
  String? color;
  num? dangerousTags;
  String? dangerousDetail;
  num? id;


  ElderTags({this.tagsName, this.color, this.dangerousTags, this.dangerousDetail,
    this.id});

  Map<String, dynamic> toJson() {
    return {
      'tagsName': this.tagsName,
      'color': this.color,
      'dangerousTags': this.dangerousTags,
      'dangerousDetail': this.dangerousDetail,
      'id': this.id,
    };
  }

  factory ElderTags.fromJson(Map<String, dynamic> map) {
    return ElderTags(
      tagsName: map['tagsName'] as String,
      color: map['color'] as String,
      dangerousTags: map['dangerousTags'] as num,
      dangerousDetail: map['dangerousDetail'] as String,
      id: map['id'] as num,
    );
  }
}
